/**
 *
 * @param option
 * @returns {*}
 */
import {extend} from "./extend";

function random(option) {
  option = extend({seed: 10, fractional: 0, size: 1, start: 0}, option);
  let sp = option.seed - option.start;
  if (option.size == 1) {
    return parseFloat(Math.random() * sp + option.start).toFixed(option.fractional);
  } else {
    let values = [];
    for (let i = 0; i < option.size; i++) {
      values.push(parseFloat(Math.random() * sp + option.start).toFixed(option.fractional))
    }
    return values;
  }
}
export {random}
